package Singleton;
public class Main {
    public static void main(String[] args) {
           //饿汉
            EagerSingleton.getEntity().setEnitityName("饿汉式");

            System.out.println("实例名称是："+EagerSingleton.getEntity().getEnitityName());

            System.out.println("第一次调用HashCode："+EagerSingleton.getEntity().showEnitityHashCode());

            System.out.println("第二次调用HashCode："+EagerSingleton.getEntity().showEnitityHashCode());



            //懒汉
            System.out.println("懒汉式");

            System.out.println("第一次调用HashCode："+LazySingleton.getEntity().showEntityHashCode());

            System.out.println("第二次调用HashCode："+LazySingleton.getEntity().showEntityHashCode());

    }
}